/*
 * @Author: Kevin Zhao
 * @Date: 2020-10-29 03:06:47
 * @LastEditTime: 2022-10-25 00:14:33
 * @LastEditors: Kevin Zhao
 * @Description: 
 * @FilePath: \tongren-rc\src\Pages\QuestEntry\index.jsx
 */
import React, { Component } from 'react'
import './index.css'
import { getSearchParams } from '../../utils/param'

export default class index extends Component {
    constructor(props) {
        super(props)
        let searchParams = getSearchParams(props.location.search)
        let hosCode = searchParams.hosCode
        if (hosCode) {
            localStorage.setItem('hosCode', hosCode)
        } else {
            localStorage.setItem('hosCode', '001')
        }

        let className = 'logo'
        if (hosCode == '002') className += ' logo002'
        if (hosCode == '003' ||
            hosCode == '004' ||
            hosCode == '005' ||
            hosCode == '006'
        ) {
            className = 'logo tdlogo'
        }
        this.state = {
            hosCode,
            className
        }
    }
    toPage(path) {
        this.props.history.push({
            pathname: '/guide',
            search: '?path=' + path
        })
    }
    back() {
        window.location.href = 'http://wx.kmtrh.org'
    }
    componentDidMount() {
        document.title = '问卷调查'
    }
    render() {
        return (
            <div className="questEntry-class">
                <div className={this.state.className}></div>
                <div className="btn">
                    <div className="btn-icon comp-icon" onClick={() => this.toPage('questComp')}></div>
                    <div className="btn-text">表扬|投诉</div>
                </div>
                <div className="btn">
                    <div className="btn-icon quest-icon" onClick={() => this.toPage('questUser')}></div>
                    <div className="btn-text">满意度调查</div>
                </div>
                {
                    this.state.hosCode === '002' ?
                        <div className='btn-back' onClick={() => this.back()}>返回首页</div>
                        : null
                }
            </div>
        )
    }
}
